@import "./variables.scss";
@import "./element-ui.scss";

/**
 * 通用css样式布局处理
 **/
// 边框 ---- radius-10
@for $i from 2 to 50 {
	.radius-#{$i} {
		border-radius: $i + px;
	}
}
// 行高 ---- line-height-10
@for $i from 10 to 50 {
	.line-height-#{$i} {
		line-height: $i + px;
	}
}

//字体 ---- fonts-xxs
@each $fontkey, $fontvalue in $font-sizes {
	.fonts-#{$fontkey} {
		font-size: $fontvalue * $base-font-size;
	}
}

//字体 ---- fs-12
@for $i from 1 through 32 {
	.fs-#{$i} {
		font-size: $i + px !important;
	}
}
// 字体粗细
@each $var in (400, 500, 600, 700, 800) {
	.fw-#{$var} {
		font-weight: $var;
	}
}
//颜色 ---- text-primary	bg-primary
@each $colorkey, $color in $colors {
	.text-#{$colorkey} {
		color: $color;
	}

	.bg-#{$colorkey} {
		background-color: $color;
	}
}

//对齐 ---- text-left
@each $var in (left, center, right) {
	.text-#{$var} {
		text-align: $var;
	}
}
// gap 边距
@for $i from 1 through 20 {
	.gap-#{$i} {
		gap: $i + px;
	}
}

//flex布局
.flex {
	display: flex;
}

.flex-wrap {
	flex-wrap: wrap;
}

// flex-1
@for $i from 0 through 12 {
	.flex-#{$i} {
		flex: $i;
	}
}
// jc-center  jc-between
@each $key, $value in $flex-jc {
	.jc-#{$key} {
		justify-content: $value;
	}
}

// ai-center
@each $key, $value in $flex-ai {
	.ai-#{$key} {
		align-items: $value;
	}
}
// fd-column  fd-row
@each $key, $value in $flex-fd {
	.fd-#{$key} {
		flex-direction: $value;
	}
}
// 定义内外边距=================
// 方法一 ：（rem）
//.mt-1 => margin top : 0.5 * 0.5rem
//spacing ---- rem

// @each $typekey, $type in $spacing-types {
// 	//.m-1
// 	@each $sizekey, $size in $spacing-sizes {
// 		.#{$typekey}-#{$sizekey} {
// 			#{$type}: $size * $spacing-base-size;
// 		}
// 	}

// 	@each $sizekey, $size in $spacing-sizes {
// 		// .mx-0,  .mx-1,  .mx-2 ...
// 		.#{$typekey}x-#{$sizekey} {
// 			#{$type}-left: $size * $spacing-base-size;
// 			#{$type}-right: $size * $spacing-base-size;
// 		}
// 		// .my-0,  .my-1,   .my-2  ...
// 		.#{$typekey}y-#{$sizekey} {
// 			#{$type}-top: $size * $spacing-base-size;
// 			#{$type}-bottom: $size * $spacing-base-size;
// 		}
// 	}

// 	// .mt-1, .mr-1
// 	@each $directionkey, $direction in $spacing-directions {
// 		@each $sizekey, $size in $spacing-sizes {
// 			.#{$typekey}#{$directionkey}-#{$sizekey} {
// 				#{$type}-#{$direction}: $size * $spacing-base-size;
// 			}
// 		}
// 	}

// 	.#{$typekey} {
// 		#{$type}: 0;
// 	}
// }

// 方法二 ：历遍1-80（px）
//.m-t-10 => margin top : 10px
//spacing ---- px
@for $i from 0 through 80 {
	// 只要双数和能被5除尽的数
	@if $i % 2 == 0 or $i % 5 == 0 {
		// 得出：margin-30或者m-30
		.m-#{$i} {
			margin: $i + px !important;
		}
		// 得出：padding-30或者p-30
		.p-#{$i} {
			padding: $i + px !important;
		}

		@each $short, $long in l left, t top, r right, b bottom {
			// 缩写版，结果如： m-l-30
			// 定义外边距
			.m-#{$short}-#{$i} {
				margin-#{$long}: $i + px !important;
			}
			//自定义左右内边距
			.m-lr-#{$i} {
				margin-left: $i + px !important;
				margin-right: $i + px !important;
			}
			//自定义上下内边距
			.m-tb-#{$i} {
				margin-top: $i + px !important;
				margin-bottom: $i + px !important;
			}

			// 定义内边距
			.p-#{$short}-#{$i} {
				padding-#{$long}: $i + px !important;
			}

			//自定义左右内边距
			.p-lr-#{$i} {
				padding-left: $i + px !important;
				padding-right: $i + px !important;
			}
			//自定义上下内边距
			.p-tb-#{$i} {
				padding-top: $i + px !important;
				padding-bottom: $i + px !important;
			}
		}
	}
}

.block {
	display: block;
}

.pointer {
	cursor: pointer;
}

.inlineBlock {
	display: block;
}

/* text color */
.text-navy {
	color: #1ab394;
}

.text-primary {
	color: inherit;
}

.text-success {
	color: #1c84c6;
}

.text-info {
	color: #23c6c8;
}

.text-warning {
	color: #f8ac59;
}

.text-danger {
	color: #ed5565;
}

.text-muted {
	color: #888888;
}

.overflowClip {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: block;
}

.overflowClip_2 {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.overflowClip_3 {
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}
